package com.tdkj.service.shop.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.tdkj.dao.shop.IBeanEvaluateTypeDao;
import com.tdkj.model.shop.BeanEvaluateType;
import com.tdkj.service.BaseService;
import com.tdkj.service.shop.IBeanEvaluateTypeService;

@Component("evaluateTypeService")
public class BeanEvaluateTypeServiceImpl extends BaseService implements
		IBeanEvaluateTypeService {

	private  IBeanEvaluateTypeDao beanEvaluateTypeDao;
    
	@Resource
	public void setBeanEvaluateTypeDao(IBeanEvaluateTypeDao beanEvaluateTypeDao) {
		this.beanEvaluateTypeDao = beanEvaluateTypeDao;
	}
	
	@Override
	public void addEvaluateType(String name, Integer score) {
		BeanEvaluateType bean = new BeanEvaluateType();
		bean.setName(name);
		bean.setScore(score);
		beanEvaluateTypeDao.save(bean);
	}

	@Override
	public void updateEvaluateType(List<Long> ids, List<Integer> scores) {
		for(int i=0;i<ids.size();i++){
			Long id = ids.get(i);
			Integer score = scores.get(i);
			BeanEvaluateType bean = beanEvaluateTypeDao.findById(id, BeanEvaluateType.class);
			bean.setScore(score);
		}
	}

}
